Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix disappearing NPCs #39753

Merged
merged 1 commit into from Apr 20, 2020
Merged

fix disappearing NPCs #39753

merged 1 commit into from Apr 20, 2020

Conversation

ghost
Copy link

@ghost ghost commented Apr 20, 2020

Summary

SUMMARY: Bugfixes "Fix Dissappearing travelling NPCs"

Purpose of change

Fixes #39712

Describe the solution

The cause was that when assigned to travelling, NPCS are given a "companion mission"
companion missions are meant to be offscreen, so they arent loaded into reality bubble.
( except when the mission is travelling ) - this special case check was everywhere.

When you told them to follow you again, after telling them to travel somewhere their npc_mission variable changed to NULL, but they still had the companion mission, hence when the game loaded, or they went offscreen, then subsequently, they were not loaded back in.

The solution is 3-fold.

  1. I have no idea why I originally made them use the companion mission framework, when they are travelling they dont need to go into the invisible aether, I cant think of any reason why this is beneficial to use that system, I may have missed some reason I took that decision way back when, but as of now I cant think of one, so I have just removed the assignation of a companion mission when asking them to travel, that way - there will be no problems loading them into the reality bubble, no matter what other series of events happen to them.

  2. in the npc talk functions, I have ensured that when telling an NPC to follow you, if they still have a companion mission, it is reset.

  3. in the faction NPC summary window, if they are on a mission, ive added a button to press to emergency recall them ( like the faction camp ) if they get stuck in off-screen limbo. - This could potentially be problematic ( if they are doing important stuff ) but less problematic than lost NPCs.

Describe alternatives you've considered

N/A

Testing

Told NPC to travel to camp, then told them to follow, then saved and reloaded game.

Before this fix : they dissappeared

after this fix : they didnt.

After this fix : could recall the stuck NPC in the city , in the attached savegame in linked issue, they then became visible when teleporting there.

Travelling on the overmap scale still occured.

Additional context

N/A

@ZhilkinSerg ZhilkinSerg added <Bugfix> This is a fix for a bug (or closes open issue) [C++] Changes (can be) made in C++. Previously named `Code` NPC / Factions NPCs, AI, Speech, Factions, Ownership labels Apr 20, 2020
@ZhilkinSerg ZhilkinSerg merged commit 8ffc095 into CleverRaven:master Apr 20, 2020
tung pushed a commit to tung/Cataclysm-DDA that referenced this pull request Jun 27, 2020
See PR CleverRaven#39753 (fix disappearing travelling NPCs) and issue CleverRaven#39712

(cherry picked from commit 2999f7a)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
<Bugfix> This is a fix for a bug (or closes open issue) [C++] Changes (can be) made in C++. Previously named `Code` NPC / Factions NPCs, AI, Speech, Factions, Ownership
Projects
None yet
Development

Successfully merging this pull request may close these issues.

"Stay with me" from Talk submenu doesn't override properly "Travel to location" command
1 participant